extends Card


func play_on_release(card_view: CardView) -> void:
	var player = card_view.get_tree().get_first_node_in_group("player")
	var player_state: PlayerInBattleState = Globals.player_state
	var tween := card_view.create_tween()
	player.play_animation("attack")
	tween.tween_callback(Shake.state_play.bind(player, StateBar.STATE.TEMP_POWER, self.power, 1))
	tween.tween_callback(Shake.state_play.bind(player, StateBar.STATE.ARMOR_BREAK, self.armor_break, 1)).set_delay(0.3)
	#这里一定要比上面的参数大，要不然可能有线程问题，因为shake方法也是个tween实现的
	tween.tween_interval(0.51)
	await tween.finished
	player.play_animation("default")
	player_state.set_temp_power(self.power, 1)
	player_state.armor_break += self.armor_break
	card_view.play_on_release_signal_finish.emit()
	
func get_desc() -> String:
	if desc_lab == "":
		return ""
	var text = (
		desc_lab
		% [
			self.armor_break,
			self.power
		]
	)
	return text


func init_from_csv(introduce):
	super.init_from_csv(introduce)
	self.armor_break = int(introduce[5])
	self.power = int(introduce[6])
